export default {
  name: "abnormal",
  components: {
    tab: () => import("../../component/tab/index.vue"),
    breakAppoint: () => import("./breakAppoint/index.vue"), // 爽约异常处理
    reexamine: () => import("./reexamine/index.vue"), // 复试异常处理
    employ: () => import("./employ/index.vue"), // 录取异常处理
    entry: () => import("./entry/index.vue"), // 入职异常处理
    dimission: () => import("./dimission/index.vue"), // 期内离职异常处理
  },
  data() {
    return {
      options: [
        // {
        //   val: '1',
        //   name: "爽约异常处理"
        // },
        // {
        //   val: '2',
        //   name: "复试异常处理"
        // },
        // {
        //   val: '3',
        //   name: "录取异常处理"
        // },
        // {
        //   val: '4',
        //   name: "入职异常处理"
        // },
        // {
        //   val: '5',
        //   name: "期内离职异常处理"
        // }
      ],
      type: "",
      title: "",
      reportDialogVisible: false,
      reportForm: {
        id: "",
        reporttype: "",
        content: ""
      }
    }
  },
  created() {
    let index = this.GLOBAL.permisstions.findIndex(item => item.power === '10');
    this.options = this.GLOBAL.permisstions[index].tablelist;
    this.options.forEach(el => {
      this.$set(el, 'val', el.table.slice(-1));
    })
    this.type = this.options[0].val;
    this.title = this.options[0].tablename;
	console.log(this.options);
	this.$set(this.options[0],'totalNum',0);
	this.$set(this.options[3],'totalNum',0);
	this.$set(this.options[4],'totalNum',0);
  },
  methods: {
    handleClick(item) {
      this.type = item.val;
      this.title = item.tablename;
    },
    closeReportDialog() {
      this.reportForm.id = '';
      this.reportForm.reporttype = '';
      this.reportForm.content = '';
    },
    getReportDialogVisible(val) {
      this.reportDialogVisible = val.isShow;
      this.reportForm.id = val.id;
      this.reportForm.reporttype = val.reporttype;
    },
    report() {
      if (!this.reportForm.content) {
        this.$message({
          message: "上报内容不能为空！",
          type: "warning"
        });
        return
      }
      this.$axios.post("/app/v1/platform/unusual/reportSubmit", this.reportForm).then(res => {
        if (res.data.code === 1) {
          this.$message({
            message: "操作成功",
            type: "success"
          });
        } else {
          this.$message({
            message: res.data.message,
            type: "error"
          });
        }
        this.reportDialogVisible = false;
      });
    }
  }
}